package com.piggy.logi.sys.api.factory;

import com.piggy.common.core.domain.R;
import com.piggy.logi.sys.api.RemoteLogiMenuService;
import com.piggy.logi.sys.api.bo.LogiSysMenuBo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 菜单服务降级处理
 *
 * @author shark
 */
@Component
public class RemoteLogiMenuFallbackFactory implements FallbackFactory<RemoteLogiMenuService> {
    private static final Logger log = LoggerFactory.getLogger(RemoteLogiMenuFallbackFactory.class);

    @Override
    public RemoteLogiMenuService create(Throwable throwable) {
        log.error("菜单服务调用失败:{}", throwable.getMessage());
        return new RemoteLogiMenuService()
        {

            @Override
            public List<Long> getButtonIdsByUserId(Long userId, String source) {
                return null;
            }

            @Override
            public R innerRemove(Long menuId, String source) {
                return null;
            }

            @Override
            public R innerEdit(LogiSysMenuBo menu, String source) {
                return null;
            }

            @Override
            public R innerAdd(LogiSysMenuBo menu, String source) {
                return null;
            }

            @Override
            public R innerTreeselect(LogiSysMenuBo menu, String source) {
                return null;
            }

            @Override
            public R innerInfo(Long menuId, String source) {
                return null;
            }

            @Override
            public R innerList(LogiSysMenuBo menu, String source) {
                return null;
            }
        };
    }
}
